package controllers;

import helpers.HeaderHelper;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import models.Domain;
import models.RecentSite;

public class SitemapServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException {
		response.setCharacterEncoding("UTF-8");
		//Set Header
		HeaderHelper headerHelper = new HeaderHelper();
		
		ArrayList<Domain> domains = new ArrayList<Domain>();
		domains = RecentSite.getRecentSiteUpdate();
        
		request.setAttribute("headerHelper", headerHelper);
		request.setAttribute("domains", domains);
		try {
			request.getRequestDispatcher("/pages/sitemap.jsp").forward(request, response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
